<?php

namespace App\Models\Acl;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Spatie\Permission\Traits\HasRoles;
use Laracasts\Presenter\PresentableTrait;

class Staff extends Authenticatable
{
    use Notifiable, HasRoles, PresentableTrait;

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $table = 'acl_staff';

    protected $guard_name = 'admin';

    protected $hidden = [
        'passwd', 'remember_token',
    ];

    protected $guarded = array();

    public $timestamps = false;

    protected $presenter = 'App\Http\Presenters\Acl\StaffPresenter';

    public function getAuthPassword()
    {
        return $this->passwd;
    }


    public function branch()
    {
        return $this->belongsTo('App\Models\Mgt\Branch');
    }


    public function role()
    {
        return $this->belongsTo('App\Models\Acl\Role');
    }


    public function supervisor()
    {
        $supervisor = \Config::get('auth.supervisor');

        return in_array($this->id, $supervisor);
    }
}
